package com.tbr.blockchain;

import com.tbr.blockchain.controller.BlockController;
import com.tbr.blockchain.p2p.P2PClient;
import com.tbr.blockchain.p2p.P2PServer;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;


@SpringBootApplication
public class BlockchainApplication {

    public static void main(String[] args) {
        ApplicationContext context = SpringApplication.run(BlockchainApplication.class, args);
        //初始化P2P服务器
        P2PServer p2pServer = (P2PServer) context.getBean("p2pServer");
        p2pServer.initP2Server();
        P2PClient p2pClient = (P2PClient) context.getBean("p2pClient");
        p2pClient.connectPeer();
    }
}
